import { createApp } from 'vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import App from '@/App.vue'
import router from '@/router'
import { permission } from '@/tools/permission'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import injectDirective from '@/directive'
import '@/css/index.less'
import pinia from '@/stores/index'
import { registerMicroApps, start } from 'qiankun'
registerMicroApps([
  // {
  //   name: 'vue2App',
  //   props: { age: 10 }, // 给子应用传数据
  //   entry: 'http://82.156.199.130:443', // 默认会加载这个html,解析里面的js,动态执行（子应用必须支持跨域）里面,是用fetch去请求的数据
  //   container: '#qianQunWraper', // 挂载到主应用的哪个元素下
  //   activeRule: '/qiankun/vue2' // 当我劫持到路由地址为/qiankun/vue2时，我就把http://localhost:8081这个应用挂载到#qianQunWraper的元素下
  // },
  {
    name: 'react',
    props: { age: 10 }, // 给子应用传数据
    entry: 'https://www.liqiantw.icu:80', // 默认会加载这个html,解析里面的js,动态执行（子应用必须支持跨域）里面,是用fetch去请求的数据
    container: '#qianQunWraper', // 挂载到主应用的哪个元素下
    activeRule: '/qiankun/react' // 当我劫持到路由地址为/qiankun/react时，我就把http://localhost:8080这个应用挂载到#qianQunWraper的元素下
  }
])
start()
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(pinia)
permission(router)
app.use(router)
app.use(ElementPlus, {
  locale: zhCn
})
injectDirective(app)

app.mount('#app')
